package com.jblapp.icu.http;

import java.util.List;

import org.apache.http.NameValuePair;
import org.json.JSONObject;

public class Authentication extends AbstractHttpRequest {
	private final static String url = "http://icu.joblean.com.cn/user.php?action=identification";
	private List<NameValuePair> parms = null;

	public Authentication(List<NameValuePair> parms) {
		this.parms = parms;
	}

	/**
	 * @param jsonMsg
	 *            The json object string that need to parse
	 * @return boolean,Return the Authentication status,if success return
	 *         true,or esle return false
	 */
	@Override
	public Object parse(String jsonMsg) throws Exception {
		JSONObject json = new JSONObject(jsonMsg);
		int status = json.getInt("status");
		if (status == 1) {
			return true;
		} else
			return false;
	}

	public boolean isSuccess() throws Exception {
		return (Boolean) this.httpPostMethod(url, parms);
	}
}
